/**
 * Created by mac on 18/1/16.
 */
var route = function () {}
module.exports = route;
var baseJson = {
    "title":[
        {
            icon:'zl zlIcon-pingtaixitongjiankong',
            isShow:false,
            name:"平台系统管理",
            isChild:true,
            child:[
                // {url:"index", name:"平台账号管理" , icon:'zl zlIcon-zhanghaoguanli'},
                {url:"area", name:"区域组织管理" , icon:'zl zlIcon-zuoyequyu'},
                {url:"authority", name:"权限管理" , icon:'zl zlIcon-quanxianguanli'},
                {url:"msg", name:"消息管理" , icon:'zl zlIcon-xiaoxi'}
            ]
        },
        {
            icon:'zl zlIcon-chanpin',
            isShow:false,
            name:"产品管理",
            isChild:true,
            child:[
                {url:"variety", name:"品类管理", icon:'zl zlIcon-leimupinleifenleileibie'},
                {url:"classification", name:"品名管理", icon:'zl zlIcon-shangpinming-hui'},
                {url:"region", name:"产地管理", icon:'zl zlIcon-yuanchandipinzhibz'},
                {url:"brand", name:"牌号管理", icon:'zl zlIcon-shebeixinghao'}
            ]
        },
        {
            icon:'zl zlIcon-dingyue',
            isShow:false,
            name:"订阅管理",
            isChild:true,
            child:[
                {url:"hgjn", name:"文章管理", icon:'zl zlIcon-wenzhang'},
                {url:"hgj", name:"广告管理", icon:'zl zlIcon-guanggaopai'},
                {url:"dfg", name:"帮助管理", icon:'zl zlIcon-bangzhu'}
            ]
        },
        {
            icon:'zl zlIcon-xiaoshoudanju',
            isShow:false,
            name:"业务单据管理",
            isChild:true,
            child:[
                {url:"hgjn", name:"单据列表", icon:'zl zlIcon-leibie'},
                {url:"hgj", name:"单据模板列表", icon:'zl zlIcon-msnui-template-web'},
                {url:"dfg", name:"单据类别列表", icon:'zl zlIcon-danjutongji'}
            ]
        },
        {
            icon:'zl zlIcon-caidan',
            isShow:false,
            name:"菜单管理",
            isChild:true,
            child:[
                {url:"hgjn", name:"自定义设置", icon:'zl zlIcon-icon'}
            ]
        }
    ]
};
var userJson = {

};
var businessJson = {

};
var isInArr = function (targetArr , str) {
    for(var i = 0 ; i < targetArr.title.length ; i ++){
        for(var y = 0 ; y < targetArr.title[i].child.length ; y ++){
            if(targetArr.title[i].child[y].url == str){
                targetArr.title[i].isShow = true;
            }
        }
    }

    return targetArr;
}
route.sift = function (preStr , nextStr) {
    var result = {};
    switch (preStr){
        case "base":
            result["type"] = 3;
            result["target"] = nextStr;
            result["content"] = isInArr(baseJson , nextStr);
            return result;
            break;
        case "business":
            break;
        case "user":
            break;
    }
};